﻿using HamcoWcs.Entitys.Logs;
using HamcoWcs.Entitys.Logss;
using HamcoWcs.Models.Exceptions;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace HamcoWcs.Contract.ContractCommon
{
    public interface ILoggerService
    {
        /// <summary>
        /// 删除日志接口
        /// </summary>
        void DeleteLog();
        /// <summary>
        /// 删除回放数据（15天）
        /// </summary>
        void DeletePayBackData();
        /// <summary>
        /// 删除通讯日志
        /// </summary>
        void DeleteCommunicateLog();
        /// <summary>
        /// 删除心跳日志（2天）
        /// </summary>
        void DeleteHBLog();
        /// <summary>
        /// 删除MES通讯日志备份
        /// </summary>
        void DeleteMesMsgBak();
        //void AddDeviceErrorLog(string plcName, string deviceName, string errorCode, string errorDetail);
        //void BackupDeviceErrorLog();
        void DeleteDeviceErrorLog();

        void AddDeviceMsgLog(string plcName, string deviceName, string taskId, string unitId, string msgValue, string direction);
        //void BackupDeviceMsgLog();
        void DeleteDeviceMsgLog();

        void InsertLoginLog(string userName, string loginIp);
        void DeleteLoginLog();

        void AddOperationLog(string userName, string controller, string methodName, string unitId, string deviceName, string remark);

        /// <summary>
        /// 删除操作日志
        /// </summary>
        void DeleteOperationLog();
        void AddSystemErrorLog(string log);

        /// <summary>
        /// 删除系统日志
        /// </summary>
        void DeleteSystemErrorLog();


        void AddWcsRunLog(string unitId, string msgValue);
        void AddWcsRunLog(WcsRunException exception);
        //void BackupWcsRunLog();

        /// <summary>
        /// 删除WCS运行日志
        /// </summary>
        void DeleteWcsRunLog();

        //void AddWmsMsgLog(string sender, string msgData, string returnData);
        //void BackupWmsMsgLog();
        //void DeleteWmsMsgLog();


        /// <summary>
        /// 添加通讯日志
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        void AddCommunicationLog(CommunicationLog log);
        /// <summary>
        /// 批量添加通讯日志
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        void AddCommunicationLogs(List<CommunicationLog> logs);

        /// <summary>
        /// 保存超过90天的日志
        /// </summary>
        //void SaveExpiredLogsToExcel(List<OperationLog> logs, string filePath);
    }
}
